package com.model;

import java.util.LinkedList;
import java.util.List;


public abstract class AbstractPlayer{
	
	protected static final double DEFAULT_BALANCE = 100;
	protected static final double MINIMUM_BET = 5;

	private double balance;
	private double bet;

	private List<Hand> hands = new LinkedList<Hand>();

	public AbstractPlayer() {
		this(MINIMUM_BET);
	}
	
	public AbstractPlayer (double bet) {
		setBet(bet);
	}
	
	public double getBalance() {
		return balance;
	}

	public void setBalance(double balance) {
		this.balance = balance;
	}
	
	public void addToBalance(double value) {
		balance += value;
	}
	
	public void removeFromBalance(double value) {
		balance -= value;
	}
	
	public double ante() {
		if (balance < getBet()) {
			System.out.println("Game Over");
			//FIXME
		}
		balance -= getBet();
		return getBet(); 
	}
	
	public boolean hit(Card card) {
		return false;
	}

	public double getBet() {
		return bet;
	}

	public void setBet(double bet) {
		this.bet = bet;
	}

	public boolean shouldSplit(Card dealerCard) {
		return false;
	}

	public List<Hand> getHands() {
		return hands;
	}
	
	public Hand getHand() {
		return hands.get(0);
	}

	public void setHands(List<Hand> hands) {
		this.hands = hands;
	}
	
	public void clearHands() {
		hands.clear();
	}
	
	public void clearHand(int index) {
		hands.remove(index);
	}

	public void addHand(Hand hand) {
		hands.add(hand);
	}
}
